package com.lmb.service.impl;

import com.lmb.bean.Lands;
import com.lmb.mapper.LandsDao;
import com.lmb.service.LandsService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LandsServiceImpl implements LandsService {
    @Autowired
    LandsDao landsDao;

    @Override
    public Lands add(Lands lands) {
        landsDao.add(lands);
        Lands result=landsDao.one(lands.getLand_id());
        return result;
    }

    @Override
    public Lands edit(Lands lands) {
        landsDao.edit(lands);
        Lands result=landsDao.one(lands.getLand_id());
        return result;
    }

    @Override
    public int del(Integer id) {
        return landsDao.del(id);
    }

    @Override
    public Lands one(Integer id) {
        return landsDao.one(id);
    }

    @Override
    public List<Lands> all(Lands lands) {

        return landsDao.all(lands);
    }

    @Override
    public void page(Page page, Lands lands) {
        int count= landsDao.pageCount(lands);
        Object data= landsDao.page(page, lands);
        page.setCount(count);
        page.setData(data);
    }
}
